Score = []
Name = []
def InsertSort():
    YearSize = 249
    Flag = True
    while Flag == True:
        Flag = Flag
        for i in range(1,YearSize-1):
            InsertedValue = Score[i]
            pointer = i-1
            while Score[pointer]>InsertedValue and pointer>-1:
                Score[pointer+1] = Score[pointer]
                Name[pointer+1][1] = Name[pointer][1]
                Name[pointer+1][2] = Name[pointer][2]
                pointer-=1
            Score[pointer+1] = InsertedValue
            Flag = True
    return Score

class TreasureChest():
    def __init__(self,question,answer,points):
        self.__question = question #string
        self.__answer = answer #integer
        self.__points = points #integer


    def getQuestion(self):
        return self.__question


    def checkAnswer(self,answer):
        if self.__answer == answer:
            return True
        else:
            return False


    def getpoints(self,attempts):
        points = self.__points
        if attempts == 1:
            return points
        elif attempts == 2:
            points = points/2
            return points
        elif attempts == 3 or 4:
            points = points/4
            return points
        else:
            return 0


def readData():
    try:
        file = open("TreasureChestData","r")
    except:
        print("file is not found")
    else:
        while True:
            data = file.readline()
            if not data:
                break
            arrayTreasureChest = data.split(",")
            TreasureChest(arrayTreasureChest[0],arrayTreasureChest[1],arrayTreasureChest[2])
        file.close()



